Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/curvature compartments fpp tutorial #30

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

maciekswat
Copy link
Collaborator

I added a full tutorial that walks users from a simulation involving a single cell to a simulation containing multiple elongated cells. Each cell is a compartmentalized cell and we used FPP and Curvature plugins to control cell shape

Copy link
Collaborator

@tjsego tjsego left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great. I only recommend fixing various typos throughout.

Copy link
Collaborator

@fyffep fyffep left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the overall style of this tutorial, and it all seems technically sound. I just have a lot of nitpick comments. I hope I can convince you to try the Grammarly plugin for VSCode.🙂 It's easy to set up, and it saved me a lot of time for doc writing.
I think the scope is well-chosen so that a person could follow this tutorial without much background knowledge.

docs/example_compartmental_elongated_cells_tutorial.rst Outdated Show resolved Hide resolved
docs/index.rst Outdated
:caption: Complete Tutorials
:hidden:

example_compartmental_elongated_cells_tutorial
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could go inside section_real_world_examples, which holds our list of complete tutorials, instead of index.rst

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the "Real-World Examples" display for you when you open documentation? It does not for me.

https://compucell3dreferencemanual.readthedocs.io/en/latest/

We might need to do some upgrades to the index but I agree we should group it

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's hidden for me too. Could you please adjust this part of index.rst

.. toctree::
   :maxdepth: 1
   :hidden:
   :caption: Real-world Examples

    section_real_world_examples

so that either maxdepth is 2 or hidden is removed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done - it worked, thanks!

docs/example_compartmental_elongated_cells_tutorial.rst Outdated Show resolved Hide resolved
Building Simulation of Elongated Cells. Case Study in using Compartments, FPP Links, Curvature energy terms.
------------------------------------------------------------------------------------------------------------

The goal of this tutorial is to build a simulation of multiple elongated cells where each sell is composed of compartments.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sell -> cell

.. note::

Our intention is to teach you how you can start building complex simulation from grounds up
by starting with a single ce,, understand the behavior of the single cell under different set of parameters
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ce,, -> cell
firs -> first


Let us now put everything together an implement elongated compartmentalized cell. The solution that will prevent two
``Center`` cells (the ones that initially were touching ``Top`` cell), from forming an extra FPP link,
is to use Curvature Plugin. The way Curvature plugin works is by constraining the angle that two adjacent links can form
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change sentence to: "The Curvature plugin constrains the angle at which two adjacent links can form."

By using high value of Curvature lambda you may constrain two adjacent links to form a straight line
and by adiabatically lowering the lambda you can control how much elongated cell can bend.
The code for this section is in ``Demos/CompuCellPythonTutorial/ElongatedCellsTutorial/Tutorial_08``

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a link to curvature.rst

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

to the cell that is created first in each cluster. We will store a list of "first" cells inside member variable
``self.list_of_leading_cells = []`` which is a list. . we have to be careful to ensure that cells stored in that list do
not disappear because if the do disappear and we try to reference them we will get Segmentation Fault Error.
We will show later how we could avoid this issue in the code , just to show you how to handle situation of that type.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To help break up this long paragraph, move

"we have to be careful to ensure that cells stored in that list do
not disappear because if the do disappear and we try to reference them we will get Segmentation Fault Error.
We will show later how we could avoid this issue in the code , just to show you how to handle situation of that type."

a little ways down so that it is closer to the code that addresses this pitfall.

The simulation code can be found in ``Demos/CompuCellPythonTutorial/ElongatedCellsTutorial/Tutorial_09``


In terms of XML modification, we only need to add a one-liner that enavbles ExternalPotential plugin that simulates
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enavbles

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

self.maxAbsLambdaX = 10

def start(self):
self.create_arranged_cells(x_s=25, y_s=25, size=5, cell_type_ids=[1, 2, 2, 2, 2, 1])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could have a comment to explain why the cells are being created in this particular pattern.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added it in different place

…lNumberOfLinks CellType="Center">2</InternalMaxTotalNumberOfLinks> to control a total number of links a given cell type can form
    <MaxTotalNumberOfLinks CellType="Center">1</MaxTotalNumberOfLinks>
    <InternalMaxTotalNumberOfLinks CellType="Center">1</InternalMaxTotalNumberOfLinks>
@maciekswat
Copy link
Collaborator Author

@fyffep Thank you for your diligent reading of the tutorial and for the comments. I addressed most of them. NOw, there is this issue of index.rst I do not see your REal-world examples displayed in the side panel so how about I move the content of the

<MaxNumberOfJunctions>2</MaxNumberOfJunctions>
</InternalParameters>

<InternalMaxTotalNumberOfLinks CellType="Center">2</InternalMaxTotalNumberOfLinks>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Although it's hard to say how much traffic our docs get, it might be worthwhile to say that InternalMaxTotalNumberOfLinks will be supported as of version 4.4.0.
Also, would this new feature work if a user omits <MaxNumberOfJunctions>2</MaxNumberOfJunctions>? To me, it seems like the override is meant to replace the old syntax since that produced less desirable results.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the simulation would work without it. While this may look like a workaround inspired by this tutorial it is not. This is an additional constraint on the number of links that a given cell type can have. We should have added it at the beginning to FPP

The total number of links a given cell can form is computed as a sum of ``<MaxNumberOfJunctions>`` values coming from ``<Parameters>``
or ``<InternalParameters>`` sections where a given cell type appears. In the example above ``Center`` can form maximum of 2 internal links (between compartments)

CompuCell3D gives you ability to override this default algorithm by adding additional tag that control the total number of links:
Copy link
Collaborator

@fyffep fyffep Sep 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: This could say, ". . . the total number of links of a given cell type." It took me a moment to realize that it's not possible to control the global, simulation-wide number of links. Instead, "total" just pertains to each cell.

@maciekswat
Copy link
Collaborator Author

@fyffep how about I merge this PR and then you can fix the details - I think it will be more efficient to do it like this rather than having an elaborate conversation here. You would just commit directly to the branch without PR. What do you think about it?

@fyffep
Copy link
Collaborator

fyffep commented Oct 13, 2024

how about I merge this PR

@maciekswat Go for it! Nitpicking is just one of my hobbies. (It's a real hobby, I swear.)
As I mentioned in my last email, you have already addressed almost all of the feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants